const morxv = require('./morxv.js')

morxv.listen({
	port: 8080
}, function (req, res) {
	morxv.setHeaders(res, {
		'Content-type': 'application/x-javascript; charset=utf-8',
		'Access-Control-Allow-Origin': '*',
		'Access-Control-Allow-Headers': 'authorization',
		'Access-Control-Allow-Methods': 'PUT, POST, GET, DELETE, OPTIONS'
	})
	try {
		morxv.bindModule(require(`.${morxv.getAbsoluteURL(req.url)}.js`), req, res)
	} catch (e) {
		res.end(JSON.stringify(e))
	}
})
